﻿using UnityEngine;
using System.Collections;

/// <summary>
/// 基础控制器
/// </summary>
public class BaseController : MonoBehaviour {

    /// <summary>
    /// 初始化
    /// </summary>
	void Start () {
        InitData();
        InitState();
        InitView();
	}
	
    /// <summary>
    /// 每帧更新
    /// </summary>
	void Update () {
        UpdateData();
        UpdateState();
        UpdateView();
	}

    /// <summary>
    /// 销毁
    /// </summary>
    void OnDestroy() {
        DestroyView();
        DestroyState();
        DestroyData();
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// 初始化数据
    /// </summary>
    protected virtual void InitData()
    {

    }

    /// <summary>
    /// 初始化控制器
    /// </summary>
    protected virtual void InitState()
    {

    }

    /// <summary>
    /// 初始化视图
    /// </summary>
    protected virtual void InitView()
    {

    }

    /// <summary>
    /// 更新数据
    /// </summary>
    protected virtual void UpdateData()
    {

    }

    /// <summary>
    /// 更新控制器
    /// </summary>
    protected virtual void UpdateState()
    {

    }

    /// <summary>
    /// 更新视图
    /// </summary>
    protected virtual void UpdateView()
    {

    }

    /// <summary>
    /// 销毁数据
    /// </summary>
    protected virtual void DestroyData()
    {

    }

    /// <summary>
    /// 销毁控制器
    /// </summary>
    protected virtual void DestroyState()
    {

    }

    /// <summary>
    /// 销毁视图
    /// </summary>
    protected virtual void DestroyView()
    {

    }
}
